// 第三方服务配置文件

module.exports = {
  // 阿里云OSS配置
  oss: {
    region: process.env.OSS_REGION || 'oss-cn-hangzhou',
    accessKeyId: process.env.OSS_ACCESS_KEY_ID,
    accessKeySecret: process.env.OSS_ACCESS_KEY_SECRET,
    bucket: process.env.OSS_BUCKET,
    endpoint: process.env.OSS_ENDPOINT || 'https://oss-cn-hangzhou.aliyuncs.com',
    timeout: 60000,
    secure: true
  },

  // 微信小程序配置
  wechat: {
    appId: process.env.WECHAT_APP_ID,
    appSecret: process.env.WECHAT_APP_SECRET,
    apiUrl: 'https://api.weixin.qq.com',
    timeout: 10000
  },

  // 短信服务配置（阿里云）
  sms: {
    accessKeyId: process.env.SMS_ACCESS_KEY_ID,
    accessKeySecret: process.env.SMS_ACCESS_KEY_SECRET,
    signName: process.env.SMS_SIGN_NAME,
    templateCode: process.env.SMS_TEMPLATE_CODE,
    endpoint: 'https://dysmsapi.aliyuncs.com',
    apiVersion: '2017-05-25'
  },

  // 邮件服务配置
  mail: {
    host: process.env.MAIL_HOST || 'smtp.qq.com',
    port: parseInt(process.env.MAIL_PORT) || 587,
    secure: false,
    auth: {
      user: process.env.MAIL_USER,
      pass: process.env.MAIL_PASS
    },
    from: process.env.MAIL_FROM
  },

  // 广告平台配置
  ads: {
    // 腾讯广点通
    gdt: {
      appId: process.env.GDT_APP_ID,
      secretKey: process.env.GDT_SECRET_KEY,
      apiUrl: 'https://api.e.qq.com',
      timeout: 10000
    },

    // 百度联盟
    baidu: {
      appId: process.env.BAIDU_AD_APP_ID,
      secretKey: process.env.BAIDU_AD_SECRET_KEY,
      apiUrl: 'https://mobads-api.baidu.com',
      timeout: 10000
    },

    // 字节跳动穿山甲
    bytedance: {
      appId: process.env.BYTEDANCE_APP_ID,
      secretKey: process.env.BYTEDANCE_SECRET_KEY,
      apiUrl: 'https://ad.oceanengine.com',
      timeout: 10000
    }
  },

  // 支付配置（预留）
  payment: {
    // 微信支付
    wechatPay: {
      appId: process.env.WECHAT_PAY_APP_ID,
      mchId: process.env.WECHAT_PAY_MCH_ID,
      key: process.env.WECHAT_PAY_KEY,
      certPath: process.env.WECHAT_PAY_CERT_PATH,
      keyPath: process.env.WECHAT_PAY_KEY_PATH,
      notifyUrl: process.env.WECHAT_PAY_NOTIFY_URL
    },

    // 支付宝
    alipay: {
      appId: process.env.ALIPAY_APP_ID,
      privateKey: process.env.ALIPAY_PRIVATE_KEY,
      publicKey: process.env.ALIPAY_PUBLIC_KEY,
      notifyUrl: process.env.ALIPAY_NOTIFY_URL,
      returnUrl: process.env.ALIPAY_RETURN_URL
    }
  },

  // 监控和分析
  monitoring: {
    // Sentry错误监控
    sentry: {
      dsn: process.env.SENTRY_DSN,
      environment: process.env.NODE_ENV || 'production',
      tracesSampleRate: 0.1
    },

    // 数据分析
    analytics: {
      googleAnalyticsId: process.env.GOOGLE_ANALYTICS_ID,
      baiduAnalyticsId: process.env.BAIDU_ANALYTICS_ID
    }
  },

  // CDN配置
  cdn: {
    domain: process.env.CDN_DOMAIN,
    accessKey: process.env.CDN_ACCESS_KEY,
    secretKey: process.env.CDN_SECRET_KEY
  }
};